<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改教务学员')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-student-edit" th:object="${teachingStudent}">
        <input name="studentId" th:field="*{studentId}" type="hidden">
        <div class="form-group">
            <label class="col-sm-3 control-label">学生姓名：</label>
            <div class="col-sm-3">
                <input name="studentName" th:field="*{studentName}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">出生年月：</label>
            <div class="col-sm-3">
                <div class="input-group date">
                    <input name="birthday" th:value="${#dates.format(teachingStudent.birthday, 'yyyy-MM-dd')}"
                           class="form-control" placeholder="请选择日期" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">主要联系人：</label>
            <div class="col-sm-2" style="width: 100px">
                <select name="familyRefMain" class="form-control" th:with="type=${@dict.getType('sys_family_ref')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:field="*{familyRefMain}"></option>
                </select>
            </div>
            <div class="col-sm-3" style="padding-left: 0px; width: 120px">
                <input name="phonenumber" th:field="*{phonenumber}" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">次要联系人：</label>
            <div class="col-sm-2" style="width: 100px">
                <select name="familyRefMinor" class="form-control"
                        th:with="type=${@dict.getType('sys_family_ref')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:field="*{familyRefMinor}"></option>
                </select>
            </div>
            <div class="col-sm-3" style="padding-left: 0px; width: 120px">
                <input name="phonenumberMinor" th:field="*{phonenumberMinor}" class="form-control" type="text">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">性别：</label>
            <div class="col-sm-2" style="width: 100px">
                <select name="sex" class="form-control b-m" th:with="type=${@dict.getType('sys_user_sex')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                            th:field="*{sex}"></option>
                </select>
            </div>
<!--            <label class="col-sm-2 control-label">所属校区：</label>-->
<!--            <div class="col-sm-3">-->
<!--                <input name="schoolName" th:field="*{schoolName}" class="form-control" type="text">-->
<!--            </div>-->
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">年级：</label>
            <div class="col-sm-3">
                <input name="grade" th:field="*{grade}" class="form-control" type="text">
            </div>
<!--            <label class="col-sm-2 control-label">报名课程：</label>-->
<!--            <div class="col-sm-3">-->
<!--                <input name="schoolName" th:field="*{courseName}" class="form-control" type="text">-->
<!--            </div>-->
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-7">
                <textarea name="remark" th:field="*{remark}" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
    var prefix = ctx + "teaching/student";
    $("#form-student-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-student-edit').serialize(), function (r){
                if (r.code==0){
                    refreshTab();
                    $.modal.alertSuccess("保存成功");
                }
            });
        }
    }

    $("input[name='birthday']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    $("input[name='graduationDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>